using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._JoinsandRelates
{
    /// <summary>
    /// <para>Add Relate</para>
    /// <para>Relates a layer to another layer or table based on a field value. Feature layers, table views, and raster layers with a raster attribute table are supported.</para>
    /// <para>根据字段值将一个图层与另一个图层或表相关联。支持要素图层、表视图和具有栅格属性表的栅格图层。</para>
    /// </summary>    
    [DisplayName("Add Relate")]
    public class AddRelate : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public AddRelate()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_layer_or_view">
        /// <para>Layer Name or Table View</para>
        /// <para>The layer or table view to which the relate table will be related.</para>
        /// <para>与相关表相关的图层或表视图。</para>
        /// </param>
        /// <param name="_in_field">
        /// <para>Input Relate Field</para>
        /// <para>The field in the input layer or table view on which the relate will be based.</para>
        /// <para>相关将基于的输入图层或表视图中的字段。</para>
        /// </param>
        /// <param name="_relate_table">
        /// <para>Relate Table</para>
        /// <para>The table or table view to be related to the input layer or table view.</para>
        /// <para>要与输入图层或表视图相关的表或表视图。</para>
        /// </param>
        /// <param name="_relate_field">
        /// <para>Output Relate Field</para>
        /// <para>The field in the relate table that contains the values on which the relate will be based.</para>
        /// <para>关联表中包含关联将基于的值的字段。</para>
        /// </param>
        /// <param name="_relate_name">
        /// <para>Relate Name</para>
        /// <para>The unique name given to a relate.</para>
        /// <para>为相关关系指定的唯一名称。</para>
        /// </param>
        public AddRelate(object _in_layer_or_view, object _in_field, object _relate_table, object _relate_field, object _relate_name)
        {
            this._in_layer_or_view = _in_layer_or_view;
            this._in_field = _in_field;
            this._relate_table = _relate_table;
            this._relate_field = _relate_field;
            this._relate_name = _relate_name;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Add Relate";

        public override string CallName => "management.AddRelate";

        public override List<string> AcceptEnvironments => ["workspace"];

        public override object[] ParameterInfo => [_in_layer_or_view, _in_field, _relate_table, _relate_field, _relate_name, _cardinality.GetGPValue(), _out_layer_or_view];

        /// <summary>
        /// <para>Layer Name or Table View</para>
        /// <para>The layer or table view to which the relate table will be related.</para>
        /// <para>与相关表相关的图层或表视图。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Layer Name or Table View")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_layer_or_view { get; set; }


        /// <summary>
        /// <para>Input Relate Field</para>
        /// <para>The field in the input layer or table view on which the relate will be based.</para>
        /// <para>相关将基于的输入图层或表视图中的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Relate Field")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_field { get; set; }


        /// <summary>
        /// <para>Relate Table</para>
        /// <para>The table or table view to be related to the input layer or table view.</para>
        /// <para>要与输入图层或表视图相关的表或表视图。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Relate Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _relate_table { get; set; }


        /// <summary>
        /// <para>Output Relate Field</para>
        /// <para>The field in the relate table that contains the values on which the relate will be based.</para>
        /// <para>关联表中包含关联将基于的值的字段。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Relate Field")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _relate_field { get; set; }


        /// <summary>
        /// <para>Relate Name</para>
        /// <para>The unique name given to a relate.</para>
        /// <para>为相关关系指定的唯一名称。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Relate Name")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _relate_name { get; set; }


        /// <summary>
        /// <para>Cardinality</para>
        /// <para><xdoc>
        ///   <para>The cardinality of the relationship.</para>
        ///   <bulletList>
        ///     <bullet_item>One to one—Specifies that the relationship between the input table and related table is one to one. For example, one record in the input table will only have one matching record in the related table.</bullet_item><para/>
        ///     <bullet_item>One to many—Specifies that the relationship between the input table and related table is one to many. For example, one record in the input table can have multiple matching records in the related table. This is the default.</bullet_item><para/>
        ///     <bullet_item>Many to many—Specifies that the relationship between the input table and related table is many to many. For example, many records with the same value in the input table can have multiple matching records in the related table.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>关系的基数。</para>
        ///   <bulletList>
        ///     <bullet_item>一对一 - 指定输入表与相关表之间的关系是一对一的。例如，输入表中的一条记录在相关表中将只有一个匹配的记录。</bullet_item><para/>
        ///     <bullet_item>一对多 - 指定输入表与相关表之间的关系为一对多。例如，输入表中的一条记录在相关表中可以有多个匹配的记录。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>多对多 - 指定输入表与相关表之间的关系为多对多。例如，输入表中具有相同值的许多记录在相关表中可以有多个匹配的记录。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Cardinality")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _cardinality_value _cardinality { get; set; } = _cardinality_value._ONE_TO_MANY;

        public enum _cardinality_value
        {
            /// <summary>
            /// <para>One to one</para>
            /// <para>One to one—Specifies that the relationship between the input table and related table is one to one. For example, one record in the input table will only have one matching record in the related table.</para>
            /// <para>一对一 - 指定输入表与相关表之间的关系是一对一的。例如，输入表中的一条记录在相关表中将只有一个匹配的记录。</para>
            /// </summary>
            [Description("One to one")]
            [GPEnumValue("ONE_TO_ONE")]
            _ONE_TO_ONE,

            /// <summary>
            /// <para>One to many</para>
            /// <para>One to many—Specifies that the relationship between the input table and related table is one to many. For example, one record in the input table can have multiple matching records in the related table. This is the default.</para>
            /// <para>一对多 - 指定输入表与相关表之间的关系为一对多。例如，输入表中的一条记录在相关表中可以有多个匹配的记录。这是默认设置。</para>
            /// </summary>
            [Description("One to many")]
            [GPEnumValue("ONE_TO_MANY")]
            _ONE_TO_MANY,

            /// <summary>
            /// <para>Many to many</para>
            /// <para>Many to many—Specifies that the relationship between the input table and related table is many to many. For example, many records with the same value in the input table can have multiple matching records in the related table.</para>
            /// <para>多对多 - 指定输入表与相关表之间的关系为多对多。例如，输入表中具有相同值的许多记录在相关表中可以有多个匹配的记录。</para>
            /// </summary>
            [Description("Many to many")]
            [GPEnumValue("MANY_TO_MANY")]
            _MANY_TO_MANY,

        }

        /// <summary>
        /// <para>Updated Input Layer or Table View</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Updated Input Layer or Table View")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _out_layer_or_view { get; set; }


        public AddRelate SetEnv(object workspace = null)
        {
            base.SetEnv(workspace: workspace);
            return this;
        }

    }

}